/* 
    > 动机：
    1. 如果一个类不再承担足够责任，不再有单独存在的理由，就可以使用【内联类】。

    > 做法：
        1. 对于待内联类中所有public函数，在目标类上创建一个对应的函数，新创建的所有函数应该直接委托至源类；
        2. 修改源类public方法的所有引用点，令它们调用目标类对应的委托方法，每次更改后运行测试；
        3. 将源类中的函数与数据全部搬移到目标类，每次修改之后进行测试，知道源类变成空壳为止；
        4. 删除源类。
*/
class TrackingInformation {
    get shippingCompany() {
        return this._shippingCompany;
    }
    set shippingCompany(arg) {
        this._shippingCompany = arg;
    }

    get trackingNumber() {
        return this._trackingNumber;
    }
    set trackingNumber(arg) {
        this._trackingNumber = arg;
    }

    get display() {
        // 这里的 this.shippingCompany 是用的get方法，不是属性，属性前面有 _
        return this.shippingCompany + this.trackingNumber;
    }
}

class Shipment {
    get trackingInfo() {
        return this._trackingInformation.display;
    }
    get trackingInformation() {
        return this._trackingInformation;
    }

    set trackingInformation(aTrackingInformation) {
        this._trackingInformation = aTrackingInformation;
    }
}

aShipment.trackingInformation.shippingCompany = request.vendor;
/**************************************************************** */
class TrackingInformation {
    get trackingNumber() {
        return this._trackingNumber;
    }
    set trackingNumber(arg) {
        this._trackingNumber = arg;
    }
}

class Shipment {
    get trackingInfo() {
        return this.shippingCompany + this.trackingNumber;
    }
    get trackingInformation() {
        return this._trackingInformation;
    }

    set trackingInformation(aTrackingInformation) {
        this._trackingInformation = aTrackingInformation;
    }

    set shippingCompany(arg) {
        this._trackingInformation.shippingCompany = arg;
    }
    get trackingNumber() {
        return this._trackingNumber;
    }
    set trackingNumber(arg) {
        this._trackingNumber = arg;
    }
    get shippingCompany() {
        return this._shippingCompany;
    }
    set shippingCompany(arg) {
        this._shippingCompany = arg;
    }
}

aShipment.shippingCompany = request.vendor;